$(document).ready(function() {
	var NumberScropp = true;
	$(window).scroll(function() {
		var WindowTop = $(window).scrollTop() + $(window).height();
		if(WindowTop > $(".m-register>li:first-child").offset().top && NumberScropp) {
			$("#num1").numberRock({
				speed: 100,
				count: 36
			});
			$("#num2").numberRock({
				speed: 40,
				count: 10000
			});
			$("#num3").numberRock({
				speed: 40,
				count: 100
			});
			$("#num4").numberRock({
				speed: 100,
				count: 30
			})
			NumberScropp = false;
		}
	})
	$(".u-acquire").on("click", function() {
		Code(".u-acquire")
	})
	/* Swiper轮播 */
	var mySwiper = new Swiper('.m-study', {
		spaceBetween: -10,
		autoplay: {
			delay: 4000,
			disableOnInteraction: false
		},
		speed: 1000,
		loop: true,
		pagination: {
			el: ".swiper-pagination",
			type: "bullets",
			clickable: true
		}
	})
	var mySwiper = new Swiper('.m-system', {
		spaceBetween: 30,
		autoplay: {
			delay: 4000,
			disableOnInteraction: false
		},
		speed: 1000,
		loop: true,
		pagination: {
			el: ".swiper-pagination",
			type: "bullets",
			clickable: true
		}
	})
	$(".m-system-top>li").each(function(i) {
		$(this).on("click", Tap)
	})
})
/* 验证码 */
var NumberCode = 60;

function Code(dom) {
	if(NumberCode == 0) {
		$(dom).attr("disabled", false).val("获取验证码")
		NumberCode = 60;
		return;
	} else {
		$(dom).attr("disabled", true).val(NumberCode + "s");
		NumberCode--;
	}
	setTimeout(function() {
		Code(".u-acquire")
	}, 1000)
}

function Tap() {
	$(this).addClass("on").siblings().removeClass("on");
	$(this).parent().siblings(".m-system-bottom").eq($(this).index()).addClass("on").siblings().removeClass("on");
}